<?php
!defined('P_W') && exit('Forbidden');
$SCR = 'info';
define('AREA_SCR','album');

InitGP(array('hid','typeid','page','other'),'',2);
if (!$hid) Showmsg('undefined_action');
$houseService = house::loadClass('house');/* @var $houseService PW_House */
$houseService->setHid($hid);
if (!$houseService->init(true)) {
	Showmsg('该楼盘不存在!');
}
$houseService->setNav();
$houseService->setBanner();
$houseinfo =& $houseService->info;
$imageService = House::loadClass('houseimage'); /* @var $imageService PW_HouseImage */
$basename = $houseBaseUrl.'q=album&hid='.$hid;
$typeid<1 && $typeid = 1;
$page<1 && $page =1;
$imageTypeService = House::loadClass('houseimagetype'); /* @var $imageTypeService PW_HouseImageType */
$imageType = $imageTypeService->getType($typeid);
if (!$imageType) Showmsg('undefined_action');
$topid = $imageType['sub'] ? (int) $imageType['sub'] : $typeid;
$topTypes = $imageTypeService->getTopTypes();
$secendTypes = $imageTypeService->getSecendTypesById($topid);
if ($typeid==$topid && !$other && $secendTypes) {
	$searchTypeid = array_keys($secendTypes);
	$searchTypeid[] = $typeid;
} else {
	$searchTypeid = $typeid;
}

$pregPage = $secendTypes ? 20 : 24;

$imageService->setPerpage($pregPage);

$pages = $imageService->getPages($hid,$searchTypeid,$page,$basename.'&typeid='.$typeid.'&other='.$other.'&');
$images = $imageService->getImages($hid,$searchTypeid,$page);

$typeRoute = $topTypes[$topid]['name'];
if ($topid==$typeid && !$other) {
	$typeRoute .= '全部';
} elseif ($topid==$typeid && $other) {
	$typeRoute .= '其他';
} else {
	$typeRoute .= $imageType['name'];
}


/* SEO */
$_definedSeo = array('title' => $houseinfo['seotitle'] , 'metaDescription' => $houseinfo['seokeywords'] , 'metaKeywords' => $houseinfo['seodescription'] );
$_seopage = 'read';
$_seoname = $houseinfo['name'];


require_once(M_P.'require/header.php');
require_once PrintEot('album');
?>